///////////////////////////////////////////////////////////////
// Copyright(c) ephiroth
// 
// FileName : formula_alte.c
// Creator  : ephiroth
// E-Mail   : ephiroth@gmail.com
// Date     : 2009-04-09
// Comment  : 
//
///////////////////////////////////////////////////////////////
#include "comm.h"


static  int func_alte ( int index , U8 * data )
{
	int m , l , f, g;
	m = trim_char ( data [26], 1 , 30 );
	l = trim_char ( data [27], 1 , 10 );
	f = trim_char ( data [28], 1 , 30 );
	g = trim_char ( data [29], 1 , 10 );
	if ( (index + 1) % 2 == 0 )
		return m + ( l* index* (index + 1))/2;
	else 
		return f + ( g* index* (index + 1))/2;
}
static void help_alte(U8 * data )
{
	int m , l , f , g ;
	m = trim_char ( data [26], 1 , 30 );
	l = trim_char ( data [27], 1 , 10 );
	f = trim_char ( data [28], 1 , 30 );
	g = trim_char ( data [29], 1 , 10 );
	printf("[隔项数列]:奇次项为%d%d作为基数偶次项为%d%d作为基数\n",m, l , f, g);
}



formula formula_alte = {
	"alte",
	ft_normal,
	10,
	func_alte,
	help_alte,
};







